﻿using PC.PickleJar.DataProviders;
using PC.PickleJar.Domain;
using PC.PickleJar.Trello.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PC.PickleJar.Trello.Data.DataProviders
{
	public class TrelloCardDataProvider : IDataProvider
	{
		public SourceItemBase GetSourceItem(ItemKeyBase itemKey)
		{
			if (itemKey as TrelloCardKey == null)
			{
				throw new ArgumentException("itemKey must be of type TrelloCardKey");
			}

			TrelloCardKey cardKey = (TrelloCardKey)itemKey;
			TrelloCard result;

			CardRepository cards = new CardRepository();
			result = cards.GetCardByShortLink(cardKey.Value);


			return result;
		}
	}
}
